/**
 * @ClassName LC905
 * @Author ykx
 * @Date 2024/6/30 17:51
 * @Version 1.0
 */
public class LC905 {
    public static void main(String[] args) {

    }

    public int[] sortArrayByParity(int[] nums) {
        int[] result = new int[nums.length];
        int left = 0, right = nums.length - 1;
        for (int num : nums) {
            if (num % 2 == 0) {
                result[left++] = num;
            } else {
                result[right--] = num;
            }
        }
        return result;
    }

}
